home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample PMSAM / PMSAM Framework / RoboSamSlot / CContentReader.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  2.7 KB  |  109 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CContentReader.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Tim Harnett
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <5>      2/6/95    TMH        made protected what was private
  13.          <4>     1/13/95    TMH        removed use of MailHandler
  14.          <3>     1/11/95    TMH        added nested letter functions, and tweak to generalize framework
  15.          <2>     11/2/94    JHB        Adding support for Sending eWorld Mail
  16.          <1>     9/20/94    TMH        Abandon RoadsideRest embrace Mercury
  17.          <2>      9/9/94    TMH        TIncoming/TOutgoing adaptations
  18.                  6/17/94    TMH        xxx put comment here xxx
  19.  
  20.     To Do:
  21. */
  22.  
  23. #ifndef __CContentReader__
  24. #define __CContentReader__
  25.  
  26. class TOutgoingXLetter;
  27. class TOutgoingALetter;
  28.  
  29. #ifndef __OCE__
  30. #include "OCE.h"
  31. #endif
  32.  
  33. #ifndef __OCEMESSAGING__
  34. #include "OCEMessaging.h"
  35. #endif
  36.  
  37. #ifndef __OCEMAIL__
  38. #include "OCEMail.h"
  39. #endif
  40.  
  41.  
  42. //------------------------------------------
  43. //        C C o n t e n t R e a d e r
  44. //------------------------------------------
  45.  
  46.  
  47. #define kReadBlockSize 500
  48. class CContentReader {
  49.  
  50. public:
  51.     CContentReader(MailMsgRef msgRef);
  52.     
  53.     OSErr            ReadContentBlock();
  54.     
  55.     virtual OSErr    ReadContent(TOutgoingXLetter* outgoingXLetter);
  56.     virtual OSErr     ReadContent(TOutgoingALetter* outgoingALetter);
  57.     
  58.     OSErr             InventoryContent();
  59.             
  60.     Boolean            SegmentType()         { return fPB.segmentType; }
  61.     long            SegmentLength()         { return fPB.segmentLength; }
  62.  
  63.     Boolean            MoreSegmentContent() { return (!fPB.endOfSegment && !fPB.endOfContent && fOSErr == 0); }
  64.     Boolean            MoreContent() { return (fOSErr==0) && !fPB.endOfContent; }
  65.  
  66.     
  67.     void*            CurrentBlock()         {  return (void*) fPB.buffer.buffer; }
  68.     unsigned long    CurrentBlockSize()    {  return fPB.buffer.dataSize; }
  69.  
  70.  
  71.  
  72.     Boolean HasText()         { return fTextLength!=0; }
  73.     Boolean HasStyledText()    { return fStyledTextLength!=0; }
  74.     Boolean HasSound()         { return fSoundLength!=0; }
  75.     Boolean HasMovie()         { return fMovieLength!=0; }
  76.     Boolean HasPict()         { return fPictLength!=0; }
  77.     Boolean HasContent()     { return ( HasText() | HasSound() | HasMovie() | HasPict() ); }
  78.     
  79.     long TextLength()         { return fTextLength; }
  80.     long StyledTextLength()    { return fStyledTextLength; }
  81.     long SoundLength()        { return fSoundLength; }
  82.     long MovieLength()        { return fMovieLength; }
  83.     long PictLength()        { return fPictLength; }
  84.     long ContentLength()     { return fTextLength+fSoundLength+fMovieLength+fPictLength; }
  85.  
  86. protected:
  87.         
  88.         long    fTextLength;
  89.         long    fStyledTextLength;
  90.         long    fSoundLength;
  91.         long    fMovieLength;
  92.         long    fPictLength;
  93.     
  94.         long    fNTextSegments;
  95.         long    fNStyledTextSegments;
  96.         long    fNSoundSegments;
  97.         long    fNMovieSegments;
  98.         long    fNPictSegments;
  99.  
  100.         MSAMGetContentPB fPB;
  101.         OSErr            fOSErr;
  102.         char            fContentReadBuf[kReadBlockSize];
  103.  
  104. };
  105.  
  106.  
  107.  
  108. #endif __CContentReader__
  109.